<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>{$lang.home}{if $ur_here} - {$ur_here} {/if}</title>
<meta name="Copyright" content="Douco Design." />
<link href="templates/public.css" rel="stylesheet" type="text/css">
{include file="javascript.htm"}
<script type="text/javascript" src="images/jquery.tab.js"></script>
<!-- <script type="text/javascript" src="images/laydate/laydate.js"></script> -->
<script type="text/javascript">
{literal}
$(function(){ 
  $(".idTabs").idTabs(); 
});
{/literal}
</script>

</head>
<body>
<div id="dcWrap">
 {include file="header.htm"}
 <div id="dcLeft">{include file="menu.htm"}</div>
 <div id="dcMain">
   {include file="ur_here.htm"}
   <div id="user" class="mainBox" style="{$workspace.height}">
    <h3> <a href="chatroom.php?rec=add" class="actionBtn add">添加房间</a> <a href="{$chatroom_link.href}" class="actionBtn">{$chatroom_link.text}</a> <a href="chatroom.php?rec=config" class="actionBtn">聊天室设置</a> {$ur_here}</h3>

    <!-- {if $rec eq 'default'} 列表 -->
    <div class="filter">
      <form action="chatroom.php" method="post">
        <input name="name" class="inpMain" placeholder="房间名" value="" size="20" type="text">
        <input name="submit" class="btnGray" value="查询" type="submit">
      </form>
    </div>

    <table width="100%" border="0" cellpadding="8" cellspacing="0" class="tableBasic">
     <tr>
      <th width="30" align="left">{$lang.record_id}</th>
      <th align="center">{$lang.thumb}</th>
      <th align="center">{$lang.room}</th>
      <th align="center">{$lang.roomnumber}</th>
      <th align="center" width="40%">{$lang.content}</th>
      <th align="center">{$lang.status}</th>
      <th align="center">{$lang.weigh}</th>
      <th>{$lang.handler}</th>
     </tr>
     <!-- {foreach from=$chatroom_list item=chatroom} -->
     <tr>
      <td align="center">{$chatroom.id}</td>
      <td align="center"><img src='../{$chatroom.img}' width="30" height="30"></td>
      <td align="center">{$chatroom.name}</td>
      <td align="center">{$chatroom.roomnumber}</td>
      <td align="center">{$chatroom.remark}</td>
      <td align="center">{$lang.status_in[$chatroom.status]}</td>
      <td align="center">{$chatroom.weigh}</td>
      <td align="center" align="center">
        <a href="chatroom.php?rec=edit&id={$chatroom.id}">{$lang.edit}</a> | 
        <a href="chatroom.php?rec=del&id={$chatroom.id}">{$lang.del}</a>  
     </tr>
     <!-- {/foreach} -->
    </table>
    {include file="pager.htm"}
    <!-- {/if} -->
    
    <!-- {if $rec eq 'edit' || $rec eq 'add'} 编辑 -->
    <script>
      var anchors = JSON.parse('{$anchors_json}');
      {literal}
        function add_html(obj){
          var str = '';
          if(obj == 'kf'){
            str += '<div class=""><input name="kf_name[]" placeholder="客服名称" value="" size="40" class="inpMain" type="text"> ';
            str += '<input name="kf_qq[]" placeholder="客服QQ" value="" size="40" class="inpMain" type="text"> ';
            str += '<input name="kf_key[]" placeholder="企业QQ KEY" value="" size="40" class="inpMain" type="text">&nbsp; <img onClick="del_kf(this);" src="images/icon_no.png"><br></div>';
          }
          if(obj == 'yc'){
            str += '<div class=""><input name="yc_mode[]" placeholder="模块标识" value="" size="40" class="inpMain" type="text"> ';
            str += '<input name="yc_name[]" placeholder="名称" value="" size="40" class="inpMain" type="text"> ';
            str += '<input name="yc_url[]" placeholder="地址" value="" size="40" class="inpMain" type="text">&nbsp; <img onClick="del_yc(this);" src="images/icon_no.png"><br></div>';
          }
          if(obj == 'live'){
            str += '<div><select name="anchor_id[]">';
            str += '<option value="">选择主播</option>';
            for (i=0; i<anchors.length; i++){
              v = anchors[i];
              str += '<option value="'+v.id+'">'+v.nickname+'|'+v.username+'</option>';
            }
            str += '</select>';
            str += '<input name="live_start[]" placeholder="开始时间" value="" size="20" class="inpMain" type="text">-';
            str += '<input name="live_end[]" placeholder="结束时间" value="" size="20" class="inpMain" type="text">&nbsp; <img onClick="del_live(this);" src="images/icon_no.png"><br></div>';
          }
          $('#'+obj+'_add_in').append(str);
        }

        function del_kf(that){
          $(that).parent().remove();
        }
        function del_yc(that){
          $(that).parent().remove();   
        }
        function del_live(that){
          $(that).parent().remove();   
        }
      {/literal}
    </script>
    <div class="idTabs">
      <ul class="tab">
        <li><a href="#main">基本信息</a></li>
        <li><a href="#kf">客服设置</a></li>
        <li><a href="#yc">预测模块</a></li>
        <!-- <li><a href="#live">直播设置</a></li> -->
      </ul>
    <div class="items">
    <form enctype="multipart/form-data" action="chatroom.php?rec={if $rec eq 'edit'}update{else}insert{/if}" method="post">
    <div id="main">
     <table width="100%" border="0" cellpadding="8" cellspacing="0" class="tableBasic">
      <tr>
       <td width="140" align="right">{$lang.room_name}</td>
       <td>
        <input type="text" name="name" value="{$chatroom.name}" size="40" class="inpMain"/>
       </td>
      </tr>
      <tr>
       <td align="right">{$lang.thumb}(68x68px)</td>
       <td>
        <input type="file" name="img" size="38" class="inpFlie" />
        {if $chatroom.img}<a href="../{$chatroom.img}" target="_blank"><img class="middle" src="../{$chatroom.img}" width="30" height="30"></a>{else}<img src="images/icon_no.png">{/if}</td>
      </tr>
      <tr>
       <td align="right">{$lang.roomnumber}</td>
       <td><input type="text" name="roomnumber" value="{$chatroom.roomnumber}" size="40" class="inpMain"/></td>
      </tr>
      <tr>
       <td align="right">{$lang.content}</td>
       <td><textarea name="remark" cols="80" rows="8">{$chatroom.remark}</textarea></td>
      </tr>
      <tr>
       <td align="right">{$lang.status}</td>
       <td>
         <select name="status">
         {foreach from=$lang.status_in item=v key=k}
         <option value="{$k}" {if $k==$chatroom.status}selected=selected{/if} >{$v}</option>
         {/foreach}
          </select>
       </td>
      </tr>
      <tr>
       <td width="100" align="right">{$lang.weigh}</td>
       <td><input type="text" name="weigh" value="{$chatroom.weigh}" size="40" class="inpMain"/></td>
      </tr>
      </table>
    </div>
    <div id="kf"><!--客服设置-->
      <table class="tableBasic" width="100%" cellspacing="0" cellpadding="8" border="0">
      <tbody id="ext_photo">
      <tr>
        <td align="right" width="140">客服设置( <a onClick="add_html('kf')" href="javascript:void(0);">增加+</a> )</td>
         <td id="kf_add_in">
            {foreach from=$chatroom.kf item=v key=k}
            <div><input name="kf_name[]" placeholder="客服名称" value="{$v.kf_name}" size="40" class="inpMain" type="text">
            <input name="kf_qq[]" placeholder="客服QQ" value="{$v.kf_qq}" size="40" class="inpMain" type="text">
            <input name="kf_key[]" placeholder="企业QQ KEY" value="{$v.kf_key}" size="40" class="inpMain" type="text">&nbsp; <img onClick="del_yc(this);" src="images/icon_no.png"><br></div>
            {/foreach}
        </td>
      </tr>
      </tbody>
      </table>
    </div>
    <div id="yc"><!--预测模块-->
      <table class="tableBasic" width="100%" cellspacing="0" cellpadding="8" border="0">
      <tbody id="ext_photo">
      <tr>
        <td align="right" width="140">预测模块( <a onClick="add_html('yc')" href="javascript:void(0);">增加+</a> )</td>
         <td id="yc_add_in">
            {foreach from=$chatroom.yc item=v key=k}
            <div><input name="yc_mode[]" placeholder="模块标识" value="{$v.yc_mode}" size="40" class="inpMain" type="text">
            <input name="yc_name[]" placeholder="名称" value="{$v.yc_name}" size="40" class="inpMain" type="text">
            <input name="yc_url[]" placeholder="地址" value="{$v.yc_url}" size="40" class="inpMain" type="text">&nbsp; <img onClick="del_kf(this);" src="images/icon_no.png"><br></div>
            {/foreach}
        </td>
      </tr>
      </tbody>
      </table>
    </div>
    <!--
    <div id="live">
      <table class="tableBasic" width="100%" cellspacing="0" cellpadding="8" border="0">
      <tbody id="ext_photo">
      <tr>
        <td align="right" width="140">直播时段设置( <a onClick="add_html('live')" href="javascript:void(0);">增加+</a> )</td>
         <td id="live_add_in">
            {foreach from=$chatroom.live item=v key=k}
            <div>
            <select name="anchor_id[]">
              <option value="">选择主播</option>
              {foreach from=$anchors item=anchor}
              <option value="{$anchor.id}" {if $v.anchor_id == $anchor.id}selected=selected{/if}>{$anchor.nickname}|{$anchor.username}</option>
              {/foreach}
            </select>
            <input name="live_start[]" placeholder="开始时间" value="{$v.live_start}" size="20" class="inpMain live_start" type="text">-
            <input name="live_end[]" placeholder="结束时间" value="{$v.live_end}" size="20" class="inpMain" type="text">&nbsp; <img onClick="del_live(this);" src="images/icon_no.png"><br></div>
            {/foreach}
        </td>
      </tr>
      </tbody>
      </table>
    </div>
    -->

      <table width="100%" border="0" cellpadding="8" cellspacing="0" class="tableBasic">
      <tr>
       <td width="140"></td>
       <td>
        <input type="hidden" name="token" value="{$token}" />
        <input type="hidden" name="id" value="{$chatroom.id}" />
        <input type="submit" name="submit" class="btn" value="{$lang.btn_submit}" />
       </td>
      </tr>
     </table>
    </form>
    </div>
    </div>
    <!-- {/if} -->


    <!-- {if $rec eq 'config'} 配置 -->
    <form action="chatroom.php?rec=config" method="post" enctype="multipart/form-data">
      <div class="idTabs">
      <ul class="tab">
        <li><a href="#main">发言设置</a></li>
        <li><a href="#backimg">图片设置</a></li>
      </ul>
      <div id="main">
        <table width="100%" border="0" cellpadding="8" cellspacing="0" class="tableBasic">
         <tr>
           <th align="left" width="200">名称</th>
           <th align="left">内容</th>
         </tr>
         <tr>
           <td align="left">允许游客留言</td>
           <td>
            <select name="allow_visitor_say">
              {foreach from=$lang.yes_no item=v key=k}
              <option value='{$k}' {if $k==$allow_visitor_say}selected='selected'{/if} >{$v}</option>
              {/foreach}
            </select>
           </td>
          </tr>
          <tr>
           <td align="left">允许发送图片</td>
           <td>
              {foreach from=$lang.group_in item=v key=k}
              <input type="checkbox" name="allow_upload_group[]" value="{$k}" {if in_array($k,$allow_upload_group)}checked='checked'{/if} /> {$v}&nbsp;
              {/foreach}
           </td>
          </tr>
          <tr>
           <td align="left">发言过滤<br>*包含该词库中词组的发言将对其中语句打*号显示</td>
           <td>
            <textarea name="say_filter" rows="8" cols="100">{$say_filter}</textarea> 多个请用|分割
           </td>
          </tr>
          <tr>
           <td align="left">IP黑名单</td>
           <td>
            <textarea name="ip_filter" rows="8" cols="100">{$ip_filter}</textarea> 多个请用|分割
           </td>
          </tr>
          <tr>
           <td align="left">封号词库<br>*包含该词库中词组的发言将不会显示在前台</td>
           <td>
            <textarea name="blacklist_filter" rows="8" cols="100">{$blacklist_filter}</textarea> 多个请用|分割
           </td>
          </tr>
        </table>
      </div>

      <div id="backimg">
        <table width="100%" border="0" cellpadding="8" cellspacing="0" class="tableBasic">
         <tr>
           <th align="right" width="200">名称</th>
           <th align="left">内容</th>
         </tr>
         <tr>
           <td align="right">网站logo(150x80px)</td>
           <td><input type="file" name="web_logo" class="inpMain">  {if $web_logo}<img class="middle" width="30" height="30" src="../{$web_logo}">{/if}</td>
          </tr>
          <tr>
           <td align="right">pc端皮肤(1920x1080px) <a onClick="add_img('pc_skins')" href="javascript:void(0);">增加+</a></td>
           <td id="add_pc_skins">
            <!-- {foreach from=$pc_skins item=item} -->
              <div><input name="pc_skins[]" type="file" name="file" class="inpMain" type="text">
              <input name="pc_skins_val[]" type="hidden" value="{$item.img}" size="40" class="inpMain"> {if isset($item.thumb)}<img class="middle" width="30" height="30" src="../{$item.thumb}">{/if} &nbsp; <img onClick="del_img(this);" src="images/icon_no.png"><br></div>
            <!--{/foreach}-->
           </td>
          </tr>
          <tr>
           <td align="right">h5背景图(750x1334px) <a onClick="add_img('h5_skins')" href="javascript:void(0);">增加+</a></td>
           <td id="add_h5_skins">
            <!-- {foreach from=$h5_skins item=item} -->
              <div><input name="h5_skins[]" type="file" name="file" class="inpMain" type="text">
              <input name="h5_skins_val[]" type="hidden" value="{$item}" size="40" class="inpMain">{if $item}<img class="middle" width="30" height="30" src="../{$item}">{/if} &nbsp; <img onClick="del_img(this);" src="images/icon_no.png"><br></div>
            <!--{/foreach}-->
           </td>
          </tr>
        </table>
      </div>
      <script>
        {literal}
          function add_img(obj){
            var str = '';
            str += '<div><input name="'+obj+'[]" type="file" name="file" class="inpMain" type="text">';
            str += '<input name="'+obj+'_val[]" type="hidden" value="" size="40" class="inpMain">&nbsp; <img onClick="del_img(this);" src="images/icon_no.png"><br></div>';
            $('#add_'+obj).append(str);
          }
          function del_img(that){
            $(that).parent().remove();   
          }
          //add_img('pc_skins');
          //add_img('h5_skins');
        {/literal}
      </script>

      <table width="100%" border="0" cellpadding="8" cellspacing="0" class="tableBasic">
       <tr>
        <td width="200"></td>
        <td>
         <input type="hidden" name="token" value="{$token}" />
         <input name="submit" class="btn" type="submit" value="{$lang.btn_submit}" />
        </td>
       </tr>
      </table>
    </form>
    <!-- {/if} -->

   </div>
 </div>
 {include file="footer.htm"}
 </div>
</body>
</html>